// ParentComponent.tsx
import { defineComponent } from 'vue'
import MyComponent from './MyComponent'

export default defineComponent({
  name: 'ParentComponent',
  setup() {
    const handleCustomEvent = (message: string) => {
      console.log('接收到来自子组件的消息：', message)
    }

    return () => (
      <div class="parent-component">
        <h2>父组件</h2>
        <MyComponent title="子组件标题" onCustom-event={handleCustomEvent}>
          {{
            default: (scopeProps: any) => (
              <p>这是父组件传递的作用域插槽内容，插槽数据：{scopeProps.message}</p>
            )
          }}
        </MyComponent>
      </div>
    )
  }
})
